<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0054)http://technoplaza.suso.org/assembly/index.cgi?p=68ks8 -->
<HTML><HEAD><TITLE>Bit Manipulation and BCD-Instructions</TITLE>
<META content="text/html; charset=windows-1252" http-equiv=Content-Type>
<META content="MSHTML 5.00.2314.1000" name=GENERATOR>
<link href="edit68k.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY bgColor=#ffffff>
<H1 class="heading">Bit Manipulation<br>
    <hr noshade>
</H1>
<br>
<span class="text">These instructions affect single bits in a byte. All instructions test the bit before affecting it.</span>
<br>
<br>
<TABLE border=0 cellPadding=0 cellSpacing=1 class="text">
  <TBODY>
    <TR>
      <TD width="50"><A 
              href="68ks8d.htm">BTST</A></TD>
      <TD width="233">Tests a bit</TD>
    </TR>
    <TR>
      <TD><A 
              href="68ks8c.htm">BSET</A></TD>
      <TD>Tests a bit, then sets it (1)</TD>
    </TR>
    <TR>
      <TD><A 
              href="68ks8b.htm">BCLR</A></TD>
      <TD>Tests a bit, then resets it (0)</TD>
    </TR>
    <TR>
      <TD><A 
              href="68ks8a.htm">BCHG</A></TD>
      <TD>Tests a bit, then inverts it (0 -&gt; 1, 1 -&gt; 0)</TD>
    </TR>
  </TBODY>
</TABLE>
&nbsp;<p>Bit field instructions allow manipulation of bits across a 32 bit 
field. Bit field instructions were introduced in the 68020 microprocessor and 
are not supported by the 68000 microprocessor. EASy68K is normally a 68000 only 
environment but does support a modified form of bit field instructions for 
educational purposes. In EASy68K the bit field instructions are restricted to 
using only 68000 addressing modes. An assembler <a href="../Directives/opt.htm">
directive</a> or menu <a href="../OPTIONS.HTM">option</a> in EASy68K enables or 
disables the assembly of bit field instructions.</p>
<TABLE border=0 cellPadding=0 cellSpacing=1 class="text" id="table1">
  <TBODY>
    <TR>
      <TD width="61"><a href="bfchg.htm">BFCHG</a></TD>
      <TD width="230">Test a bit field, then complement it</TD>
    </TR>
    <TR>
      <TD><a href="bfclr.htm">BFCLR</a></TD>
      <TD>Test a bit field, then clear it to 0</TD>
    </TR>
    <TR>
      <TD><a href="bfexts.htm">BFEXTS</a></TD>
      <TD>Test a bit field, then sign extend it to 32 bits and load it into the 
		specified data register</TD>
    </TR>
    <TR>
      <TD><a href="bfextu.htm">BFEXTU</a></TD>
      <TD>Test a bit field, then zero extend it to 32 bits and load it into the 
		specified data register</TD>
    </TR>
    <TR>
      <TD><a href="bfffo.htm">BFFFO</a></TD>
      <TD>Test a bit field, then put the bit number of the first bit that 
		contains 1 in the specified data reigster</TD>
    </TR>
    <TR>
      <TD><a href="bfins.htm">BFINS</a></TD>
      <TD>Insert the bit field from the specified data register into the 
		destination, then set the condition codes</TD>
    </TR>
    <TR>
      <TD><a href="bfset.htm">BFSET</a></TD>
      <TD>Test a bit field, then set it to 1</TD>
    </TR>
    <TR>
      <TD><a href="bftst.htm">BFTST</a></TD>
      <TD>Test a bit field</TD>
    </TR>
  </TBODY>
</TABLE>
<p>&nbsp;</p>
<P align=left><span class="subheading"><FONT color=#000080><A 
        name=bcdinst></A></FONT></span>
</BODY></HTML>
